﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaperList.aspx.cs" Inherits="OnLineExam.Web.mag.PaperList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../jquery-easyui-1.2.5/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../jquery-easyui-1.2.5/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../jquery-easyui-1.2.5/jquery-1.7.1.min.js" type="text/javascript"></script> 
    <script src="../jquery-easyui-1.2.5/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../Scripts/jQuery.FillOptions.js" type="text/javascript"></script>
    <script src="../jquery-easyui-1.2.5/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="PaperList.js?v=1" type="text/javascript"></script>
    <script type="text/javascript"><!--
        $(function () {
            $("#selectDep").FillOptions('GetDepInfoHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', { datatype: "json", textfield: "Name", valuefiled: "ID" });
            $("#selectCourse").FillOptions('GetCourseHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', { datatype: "json", textfield: "CourseName", valuefiled: "CourseID" });
            $("#selectDep1").FillOptions('GetDepInfoHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', { datatype: "json", textfield: "Name", valuefiled: "ID" });
             $("#selectDep1").attr("value", '<%=Umodel.DepID %>');
            <%if (User.IsInRole("教师")){ %>
                $("#dd table tr").eq(0).hide();$("#selectDep1").attr("disabled", 'disabled');
                        //$("#selectDep").attr("disabled", 'disabled'); //默认选中disabled
                        <%} %>
            $("#selectDep").change(function () {
            $("#selectCourse").empty();
             $("#selectCourse").FillOptions('GetCourseHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid='+$("#selectDep").val(), { datatype: "json", textfield: "CourseName", valuefiled: "CourseID" });
             });
             $("#selectDep1").change(function () { 
                
                getdata($(this).val());
            });

            $('#tt').datagrid({
                idField: 'ID',
                url: 'Handler/PaperHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', //?startIndex=0&endIndex=20  /''+ index +'/'
                singleSelect: true,
                columns: [[
                   { field: 'PaperID', title: 'ID' },
                  { field: 'PaperName', title: '试卷名称', width: 250 },
                  { field: 'startExamTime', title: '开始时间', width: 80 },
                  { field: 'EndExamTime', title: '结束时间', width: 80 },
                  { field: 'ExamTime', title: '考试时长', width: 80 },
                  { field: 'allowExamNum', title: '允许次数', width: 80 },
				  { field: 'passMark', title: '及格分数', width: 80 },

				  
				  {
					  field: 'opt00', title: '参试率', width: 100, align: 'center',
					  formatter: function (value, rec, index) {
						  var e = " <a href='examInfo.aspx?id=" + rec.PaperID + "' target='_blank'>查看</a>";

						  return e;
					  }
				  },
                   { field: 'opt1', title: '预览', width: 100, align: 'center',
                      formatter: function (value, rec, index) {
                          var e =" <a href='viewtest.aspx?PaperID="+rec.PaperID+"' target='_blank'>预览</a>";
                           
                          return e ;
                      }
                  },
                  { field: 'opt', title: '操作', width: 100, align: 'center',
                      formatter: function (value, rec, index) {
                          var e = '<a href="#" mce_href="#" onclick="edit(' + rec.PaperID + ')">编辑</a> ';
                          var d = '<a href="#" mce_href="#" onclick="del(' + index + ')">删除</a> ';
                          return e + d;
                      }
                  }
                ]],
                toolbar: [{
                    text: '增加', iconCls: 'icon-add', handler: function () {
                    $("#selectDep").attr("value",'<%=Umodel.DepID %>');
                    add();
                    }
                } ,
                { text: '查找', iconCls: 'icon-search' }
                ],
                pagination: true, rownumbers: false
            }); 
        })
// --></script>
</head>
<body><%--
    <table id="tt_paperlist" class="easyui-datagrid" style="width:700px;height:250px"

			url="Handler/PaperListHandler.ashx?depid=<%=Umodel.DepID %>"

			title="Load Data" iconCls="icon-save"

			rownumbers="true" pagination="true" singleSelect="true" fitColumns="true">

		<thead>

			<tr>

				<th field="PaperID" width="80">序号</th>

				<th field="PaperName" width="120">试卷名称</th>

				<th field="listprice" width="80" align="right">List Price</th>

				<th field="unitcost" width="80" align="right">Unit Cost</th>

				<th field="attr1" width="200">Attribute</th>

				<th field="status" width="60" align="center">Stauts</th>

			</tr>

		</thead>

	</table>--%>
    <select id="selectDep1" name="selectDep1" >
          <option value="全部">全部</option>
      </select>
    <table id="tt"></table>
    <div id="dd" class="easyui-dialog" style=" height:500px; width:850px;padding:10px 20px" closed="true" buttons="#dd-buttons">  
      <form id="ff" method="post"> <input id="hdType" name="hdType" type="hidden" />
     <input id="hdID" name="hdID" type="hidden" /> 
     <input id="hdDepID" name="hdDepID" type="hidden" value='<%=Umodel.DepID %>' />
                <table style="width: 100%;" align="left">
                    <tr>
                        <td align="right">
                            部门：</td>
                        <td align="left" colspan="3">
                            <select id="selectDep" name="selectDep"  
                                name="state" style="width:200px;" required="true" >
                                <option></option>
                            </select></td>
                    </tr>
                    <tr>
                        <td align="right">
                            &nbsp;
                            试卷科目:</td>
                        <td align="left" colspan="3">
                            <select id="selectCourse" name="selectCourse" name="state" style="width:200px;" required="true" >
                                <option></option>
                            </select></td>
                    </tr>
                    <tr>
                        <td align="right">
                            &nbsp;
                            试卷名称：</td>
                        <td align="left" colspan="3">
                            <textarea id="txtPaperName" name="txtPaperName" class="easyui-validatebox" cols="50" name="S1" rows="2" required="true"></textarea>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            &nbsp;
                            开始日期：</td>
                        <td align="left">
                            <input class="easyui-datetimebox" id="txtStartDateTime" name="txtStartDateTime" required="true"  style="width:150px"></td>
                        <td align="right">
                            结束日期：
                        </td>
                        <td>
                            <input class="easyui-datetimebox" id="txtEndDateTime" name="txtEndDateTime" required="true"  style="width:150px">&nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right"> &nbsp; 考试时长：</td>
                        <td align="left">
                            <input id="txtExamTime" name="txtExamTime" class="easyui-numberspinner" max="150" min="10" required="true" 
                                style="width:80px;" />分钟</td>
                        <td align="right">
                            可考试次数：</td>
                        <td>
                            <input id="txtallowExamNum" name="txtallowExamNum" class="easyui-numberspinner" max="10" min="1" required="true" 
                                style="width:80px;" /> 数字范围：1-10</td>
                    </tr>
                    <tr>
                        <td align="right"> 及格分数：</td>
                        <td align="left">
                            <input id="txtpassmark" name="txtpassmark" class="easyui-numberspinner" max="150" min="10" precision="0" required="true" 
                                style="width:80px;" /></td>
                        <td align="right">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right"> 选择参试人员：</td>
                        <td align="left" colspan="3" style="border-bottom-color: #C1DAD7">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right"> 参试人员：</td>
                        <td align="left" colspan="3">
                            <textarea id="txtJoinEmpID" name="txtJoinEmpID" class="easyui-validatebox" validType="minLength[5]" cols="65" name="S2" rows="5"></textarea></td>
                    </tr>
                    <tr>
                        <td align="right">&nbsp;</td>
                        <td align="left" colspan="3"  >
                            &nbsp;</td>
                    </tr>
                    
                    <tr>
                        <td align="right"><strong>单选题</strong>：</td>
                        <td align="left" colspan="3"  >
                            题目数量：<input 
                                id="txtSingleNum" name="txtSingleNum" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;" />&nbsp;每题分数：<input 
                                id="txtSingleFen" name="txtSingleFen" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/> 说明：数量0到50正整数；分数0到50 允许2位小数</td>
                    </tr>

                   <tr>
                        <td align="right"><strong>多选题</strong>：</td>
                        <td align="left" colspan="3"  >
                            题目数量：<input 
                                id="txtMultiNum" name="txtMultiNum" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/>&nbsp;每题分数：<input 
                                id="txtMultiFen" name="txtMultiFen" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/> 说明：数量0到50正整数；分数0到50 允许2位小数</td>
                    </tr>
                    <tr>
                        <td align="right"><strong>判断题</strong>：</td>
                        <td align="left" colspan="3"  >
                            题目数量：<input 
                                id="txtJudgeNum" name="txtJudgeNum" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/>&nbsp;每题分数：<input 
                                id="txtJudgeFen" name="txtJudgeFen" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/> 说明：数量0到50正整数；分数0到50 允许2位小数</td>
                    </tr>

                    <tr>
                        <td align="right"><strong>填空题</strong>：</td>
                        <td align="left" colspan="3"  >
                            题目数量：<input 
                                id="txtFillBlankNum" name="txtFillBlankNum" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/>&nbsp;每题分数：<input 
                                id="txtFillBlankFen" name="txtFillBlankFen" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/> 说明：数量0到50正整数；分数0到50 允许2位小数</td>
                    </tr>

                   <tr>
                        <td align="right"><strong>问答题</strong>：</td>
                        <td align="left" colspan="3"  >
                            题目数量：<input 
                                id="txtQuestionNum" name="txtQuestionNum" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/>&nbsp;每题分数：<input 
                                id="txtQuestionFen" name="txtQuestionFen" class="easyui-numberspinner" max="50" min="0" precision="0" 
                                required="true" style="width:80px;"/> 说明：数量0到50正整数；分数0到50 允许2位小数</td>
                    </tr>
                    </table>
    </form>
</div>
<div id="dd-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">保存</a>

		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dd').dialog('close')">取消</a>

	</div>

 
</body>
</html>
<script >
    function getdata(depid) {
        $('#tt').datagrid({
            idField: 'ID',
            url: 'Handler/PaperHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid='+depid, //?startIndex=0&endIndex=20  /''+ index +'/'
            singleSelect: true,
            columns: [[
                   { field: 'PaperID', title: 'ID' },
                  { field: 'PaperName', title: '试卷名称', width: 250 },
                  { field: 'startExamTime', title: '开始时间', width: 80 },
                  { field: 'EndExamTime', title: '结束时间', width: 80 },
                  { field: 'ExamTime', title: '考试时长', width: 80 },
                  { field: 'allowExamNum', title: '允许次数', width: 80 },
                  { field: 'passMark', title: '及格分数', width: 80 },

                   { field: 'opt1', title: '预览', width: 100, align: 'center',
                       formatter: function (value, rec, index) {
                           var e = " <a href='viewtest.aspx?PaperID=" + rec.PaperID + "' target='_blank'>预览</a>";

                           return e;
                       }
                   },
                  { field: 'opt', title: '操作', width: 100, align: 'center',
                      formatter: function (value, rec, index) {
                          var e = '<a href="#" mce_href="#" onclick="edit(' + rec.PaperID + ')">编辑</a> ';
                          var d = '<a href="#" mce_href="#" onclick="del(' + index + ')">删除</a> ';
                          return e + d;
                      }
                  }
                ]],
            toolbar: [{
                text: '增加', iconCls: 'icon-add', handler: function () {
                    $("#selectDep").attr("value", '<%=Umodel.DepID %>');
                    add();
                }
            },
                { text: '查找', iconCls: 'icon-search' }
                ],
            pagination: true, rownumbers: false
        }); 
    }
</script>